import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)

// 组件映射到路由
export const routers = [
  {
    path: '/form',
    name: '/form',
    component: () => import('@/views/form/index')
  },
  {
    path: '/list',
    name: '/list',
    component: () => import('@/views/list/index')
  },
  {
    path: '/chartShow',
    name: '/chartShow',
    component: () => import('@/views/chart/index')
  },
  {
    path: '/',
    name: '/home',
    component: () => import('@/views/home/index')
  },
  {
    path: '/chartDiff',
    name: '/chartDiff',
    component: () => import('@/views/diff-chart/index')
  }
]

// 创建路由绑定映射表
const createRouter = () =>
  new Router({
    routes: routers
  })

const router = createRouter()

// export function resetRouter () {
//   const newRouter = createRouter()
//   // reset router
//   router.matcher = newRouter.matcher
// }

export default router

// export default new Router({
//   routes: [
//     {
//       path: '/',
//       name: 'HelloWorld',
//       component: HelloWorld
//     }
//   ]
// })
